<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>首页列表</title>
	<script type="text/javascript" src="<%=basePath%>skin/js/jquery-1.9.1.min.js"></script>
	<script language="javascript">
	 $().ready(function(){
		 $("#add").click(function(){
			 window.location.href="<%=basePath%>admin/indexImage/add.shtml";
		 });
	 });
	 </script>
  </head>
  
  <body background='skin/images/allbg.gif'>
	  <form action="<%=basePath%>admin/indexImage/list.shtml" id="form1" name="form1" method="get">
		  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D1DDAA" align="center">
			  <tr>
			  	<td align="left">
			  		<input type="button" id="add" name="add" value="添加"/>
			  	</td>
				<td align="right">
					<select name="field">
						<option value="title" selected>标题</option>
					</select>
					<input name="keyword" type="text" id="keyword" value="${paramBean.keyword }" size="20" />
			  		<input type="submit" name="add" value="查询"/>
			  	</td>
			  </tr>
		  </table>
	  </form>
	  <table width="100%" border="0" class="onelineTable" cellpadding="2"
			cellspacing="1" bgcolor="#D1DDAA" align="center">
			<tr align="center" bgcolor="#E7E7E7" height="22">
				<td width="15%">
					类型
				</td>
				<td width="15%">
					排序
				</td>
				<td width="10%">
					标题
				</td>
				<td width="20%">
					图片
				</td>
				<td width="15%">
					创建日期
				</td>
				<td width="15%">
					修改日期
				</td>
				<td width="10%">
					操作
				</td>
			</tr>
			<c:forEach items="${ pagination.recordList}" var="indexImage">
				<tr align='center' bgcolor="#FFFFFF"
						onMouseMove="javascript:this.bgColor='#FCFDEE';"
						onMouseOut="javascript:this.bgColor='#FFFFFF';" height="50">
					<td>
			  			<c:choose>
			  				<c:when test="${indexImage.type == 0}">轮播图片</c:when>
			  				<c:when test="${indexImage.type == 1}">产品分类</c:when>
			  				<c:when test="${indexImage.type == 2}">大家都喜欢</c:when>
			  				<c:when test="${indexImage.type == 3}">新品上架</c:when>
			  				<c:when test="${indexImage.type == 4}">热销排行</c:when>
			  				<c:otherwise>${indexImage.type}</c:otherwise>
			  			</c:choose>
			  		</td>
			  		<td>${indexImage.orders}</td>
			  		<td>${indexImage.title}</td>
			  		<td>
			  			<c:if test="${not empty indexImage.source}">
			  				<a href="${indexImage.url}" target="_blank"><img src="<%=basePath%>download.shtml?filepath=${indexImage.source}" width="80" height="50" title="${indexImage.title}"/></a>
			  			</c:if>
			  		</td>
			  		<td><fmt:formatDate value="${indexImage.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			  		<td><fmt:formatDate value="${indexImage.modifyDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			  		<td>
				  		<a href="<%=basePath%>admin/indexImage/edit.shtml?id=${indexImage.id}">编辑</a> 
				  		<a href="<%=basePath%>admin/indexImage/view.shtml?id=${indexImage.id}">查看</a> 
			  		</td>
			  	</tr>
		  	</c:forEach>
			<tr align="right" bgcolor="#EEF4EA">
				<td height="36" colspan="11" align="center">
					${pagination.pageHtml }
				</td>
			</tr>
	  </table>
  </body>
</html>
